import Vue from "vue";
import Router from "vue-router";
import HelloWorld from "@/components/HelloWorld";
import Root from "@/view/root";
import RootData from "@/view/rootData";
import Index from "@/view/index";
import Login from "@/view/login";
import About from "@/view/about";
import Register from "@/view/register";
import Resetpsw from "@/view/resetpsw";

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: "/",
      redirect: "/index",
      component: Root,
      children: [
        { path: "index", name: "index", component: Index },
        { path: "login", name: "login", component: Login },
        { path: "about", name: "about", component: About },
        { path: "register", name: "register", component: Register },
        { path: "resetpsw", name: "resetpsw", component: Resetpsw }
      ]
    },
    {
      path: "/rootData",
      name: "rootData",
      redirect: "/operationData",
      component: RootData,
      children: [
        {
          path: "/operationData",
          name: "operationData",
          component: resolve =>
            require(["@/view/data/operationData.vue"], resolve)
        },
        {
          path: "/accountMessage",
          name: "/accountMessage",
          redirect: "/accountMessage/basicInfo",
          component: resolve =>
            require(["@/view/data/accountMessage.vue"], resolve),
          children: [
            {
              path: "/accountMessage/basicInfo",
              name: "basicInfo",
              component: resolve =>
                require(["@/view/operation/basicInfo.vue"], resolve)
            },
            {
              path: "/accountMessage/financialInfo",
              name: "financialInfo",
              component: resolve =>
                require(["@/view/operation/financialInfo.vue"], resolve)
            },
            {
              path: "/accountMessage/withdrawal",
              name: "withdrawal",
              component: resolve =>
                require(["@/view/operation/withdrawal.vue"], resolve)
            },
            {
              path: "/accountMessage/amendPsw",
              name: "amendPsw",
              component: resolve =>
                require(["@/view/operation/amendPsw.vue"], resolve)
            },
            {
              path: "/accountMessage/withdrawalRecord",
              name: "withdrawalRecord",
              component: resolve =>
                require(["@/view/operation/withdrawalRecord.vue"], resolve)
            }
          ]
        }
      ]
    }
  ]
});
